import request from '@/utils/request'
// 查询
export function fetchList(data) {
  return request({
    url:'/products/selectprolists.action',
    method:'post',
    data
  })
}

// 编辑
export function updateProduct(data) {
  return request({
    url:'/products/updateByPrimaryKeySelective.action',
    method:'post',
    data
  })
}
// 上传商品图片（多个）
export function updateProductImg(data) {
  return request({
    url:'/filepicture/insertSelective.action',
    method:'post',
    headers: {'Content-Type': 'multipart/form-data'},
    data
  })
}

export function fetchSimpleList(params) {
  return request({
    url:'/product/simpleList',
    method:'get',
    params:params
  })
}

export function deleteProduct(data) {
  return request({
    url:'/products/deleteByPrimaryKey.action',
    method:'post',
    data
  })
}

export function updateNewStatus(params) {
  return request({
    url:'/product/update/newStatus',
    method:'post',
    params:params
  })
}

export function updateRecommendStatus(params) {
  return request({
    url:'/product/update/recommendStatus',
    method:'post',
    params:params
  })
}

export function updatePublishStatus(params) {
  return request({
    url:'/product/update/publishStatus',
    method:'post',
    params:params
  })
}

export function createProduct(data) {
  return request({
    url:'/product/create',
    method:'post',
    data:data
  })
}

// export function updateProduct(id,data) {
//   return request({
//     url:'/product/update/'+id,
//     method:'post',
//     data:data
//   })
// }

export function getProduct(id) {
  return request({
    url:'/product/updateInfo/'+id,
    method:'get',
  })
}

